package Day09_Ex1_inheritence_poly;
import java.util.AbstractList;
public class ArrayBikeStore<T> extends AbstractList<T>{

	private T[] store;
	private int count;
	
	@SuppressWarnings("unchecked")
	public ArrayBikeStore()
	{
		store = (T[])(new Object[100]);
		count = 0;
	}
	
	public ArrayBikeStore(T[] t, int startingSize)
	{
		store = t;
		count =startingSize;
	}
	
	@Override
	public T get(int index) {
		return store[index];
	}

	@Override
	public int size() {
		return count;

	}

	public T set(int index, T element) {
		throw new UnsupportedOperationException();
	};
	
	public boolean add(T e) {
		store[count] = e;
		count++;
		
		return true;
		};
	
	@Override
	public T remove(int index) {
		count--;
		return store[index];
	}
	}
